package com.example.controller;

import com.example.common.result.Result;
import com.example.entity.hz.Messagepz;
import com.example.service.MessagepzService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@CrossOrigin // 跨域
@RestController
@RequestMapping("/api/MessagePz")
@Api(tags = "消息(模版)与(请求路径)配置前端控制器")
public class MessagePzController {

    @Resource
    private MessagepzService messagepzService;

    @ApiOperation("新增消息配置")
    @PostMapping("/saveMessage")
    public Result saveMessage(@RequestBody List<Messagepz> messagepzList){
        return this.messagepzService.saveMessage(messagepzList);
    }

    @ApiOperation("分页查询消息配置")
    @PostMapping("/queryIPage/{current}/{size}")
    public Result<Map<String,Messagepz>> queryIPage(@PathVariable Integer current, @PathVariable Integer size){
        return this.messagepzService.queryIPage(current,size);
    }

    @ApiOperation("删除消息配置")
    @PostMapping("/deleteMessage")
    public Result deleteMessage(@RequestBody List<Integer> uuidList){
        return this.messagepzService.deleteMessage(uuidList);
    }

    @ApiOperation("通过uuid进行查询详情信息")
    @GetMapping("/queryOne/{uuid}")
    public Result<Messagepz> queryOne(@PathVariable Integer uuid){
        return this.messagepzService.queryOne(uuid);
    }

    @ApiOperation("修改消息配置")
    @PostMapping("/updateMessage")
    public Result updateMessage(@RequestBody Messagepz messagepz){
        return this.messagepzService.updateMessage(messagepz);
    }

}
